function largestPalindromeProduct(n) {
    let low = Math.pow(10, n - 1), high = Math.pow(10, n) - 1;
    let best = 1;
    for (let i = low; i <= high; i++) {
        let t = ("" + i).split("").reverse().join("");
        let m = parseInt(i + t);
        for (let j = low; j <= high; j++) {
            if (m % j === 0 && m / j >= low && m / j <= high) {
                if (m > best) {
                    best = m;
                }

            }
        }

    }
    return best;
}

console.log(largestPalindromeProduct(3))
